/***************************** 	
FILE NAME:  do_file_populism.do
DATE:		2/2025
PURPOSE:    1. Create tables for the description of the variables
            2. Estimating regressions and the predicted probabilities for model 1 and 2 
			3. Estimating regressions for the Online Appendix
INPUT:      data_populism.dta
OUTPUT:		1. Descriptive statistics (Tables 1-3)
			2. Table 4 and Figures 2 and 3
			3. Tables for Online Appendix
				

AUTHOR:     Vered Porzycki, Odelia Oshri, Shaul R. Shenhav
********************************/
use "G:\My Drive\university\phd\women image\european union politics\for publication\data files for replication\data_populism.dta"


*1. Tables for the description of the variables*:
*Table 1: Proportion of female MEPs in radical-right and mainstream parties by plenary session
tab women_rate party if term==1, row
tab women_rate party if term==2, row
tab women_rate party if term==3, row


*Table 2: Distribution of Speeches, by party and plenary session

tab party if term==1
tab party if term==2
tab party if term==3

*Table 3: Attention to conservative and progressive gender values by party family
tab populistparty Q2victims if term==1, row
tab populistparty Q2victims if term==2, row
tab populistparty Q2victims if term==3, row

tab populistparty Q2samerights if term==1, row
tab populistparty Q2samerights if term==2, row
tab populistparty Q2samerights if term==3, row


*2. Estimating regressions and the predicted probabilities for model 1 and 2

*Estimating regession - Model 1:
logit Q2victims populistparty##c.women_rate genderofthespeaker femm_com party_chair_gender seniority i.state i.term, or cluster(party)
estimates store q2victims
estat ic


*Estimating the predicted probabilities - Model 1:
margin, atmeans at(women_rate= ( 15 (5) 70) populistparty=(0 1) )
marginsplot,  addplot(histogram women_rate if populistparty==0 ,  width(1) fcolor(gs10) lcolor(none) || (histogram women_rate if populistparty==1, width(1) fcolor(red) lcolor(none) ))


*Estimating regession - Model 2:
logit Q2samerights populistparty##c.women_rate genderofthespeaker femm_com party_chair_gender seniority i.state i.term , or cluster(party)
estimates store Q2samerights
estat ic


*Estimating the predicted probabilities - Model 2:
margin, atmeans at(women_rate= ( 15 (5) 70) populistparty=(0 1) )
marginsplot,  addplot(histogram women_rate if populistparty==0 ,  width(1) fcolor(gs10) lcolor(none) || (histogram women_rate if populistparty==1, width(1) fcolor(red) lcolor(none) ))

*Combining to 1 table:
esttab q2victims Q2samerights using values_dec_2023_3.rtf , eform constant nogap se(2) b(2)

------------------------------------------

*3. Estimating regressions for the Online Appendix:

*3.1 Appendix B: Regressions by gender of the speaker**
*B1. Women:
logit Q2victims i.populistparty##c.women_rate  femm_com party_chair_gender seniority i.state i.term if genderofthespeaker==1, or cluster(party)
estimates store Q2victims_women_speakers

logit Q2samerights i.populistparty##c.women_rate  femm_com party_chair_gender seniority i.state i.term if genderofthespeaker==1, or cluster(party)
estimates store Q2samerights_women_speakers
esttab  Q2victims_women_speakers Q2samerights_women_speakers using women_speakers.rtf , eform constant nogap se(2) b(2)

*B2. Men:
logit Q2victims i.populistparty##c.women_rate  femm_com party_chair_gender seniority i.state i.term if genderofthespeaker==0, or cluster(party)
estimates store Q2victims_men_speakers
logit Q2samerights i.populistparty##c.women_rate  femm_com party_chair_gender seniority i.state i.term if genderofthespeaker==0, or cluster(party)
estimates store Q2samerights_men_speakers
esttab Q2victims_men_speakers Q2samerights_men_speakers  using men_speakers.rtf , eform constant nogap se(2) b(2)


*3.2 Appendix C: Regressions without Netherlands*
logit Q2victims populistparty##c.women_rate genderofthespeaker femm_com party_chair_gender seniority i.state i.term if state!=3, or cluster(party)
estimates store Q2victims_uk_fr
logit Q2samerights populistparty##c.women_rate genderofthespeaker femm_com party_chair_gender seniority i.state i.term if state!=3 , or cluster(party)
estimates store Q2samerights_uk_fr
esttab Q2victims_uk_fr Q2samerights_uk_fr using uk_fr.rtf , eform constant nogap se(2) b(2)



*3.3 Appendix E1. Proportion of women supporters
logit Q2victims female_voters populistparty##c.women_rate genderofthespeaker femm_com seniority party_chair_gender i.state i.term, or
estimates store female_voters_victims
logit  Q2samerights female_voters populistparty##c.women_rate genderofthespeaker femm_com seniority party_chair_gender i.state i.term, or
estimates store female_voters_no_need
esttab female_voters_victims female_voters_no_need using female_voters.rtf , eform constant nogap se(2) b(2)

*3.4 Appendix E2: Country-level gender equality
logit Q2victims gen_ineq_nov23 populistparty##c.women_rate genderofthespeaker femm_com seniority party_chair_gender i.state i.term, or
estimates store gen_ineq_nov23_victims
logit Q2samerights gen_ineq_nov23 populistparty##c.women_rate genderofthespeaker femm_com seniority party_chair_gender i.state i.term, or
estimates store gen_ineq_nov23__no_need
esttab gen_ineq_nov23_victims gen_ineq_nov23__no_need using gen_ineq_nov23.rtf , eform constant nogap se(2) b(2)

*3.5 Appendix E3: Party-level gender equality
reg chess populistparty##c.women_rate genderofthespeaker femm_com party_chair_gender seniority i.state i.term
estimates store chess
esttab  chess using chess.rtf , nogap se(2) b(2)

*3.6 Appendix E4: Regressions without confounders
logit Q2victims populistparty##c.women_rate, or
estimates store model_1_no_controls
logit Q2samerights populistparty##c.women_rate, or
estimates store model_2_no_controls
esttab model_1_no_controls model_2_no_controls  using no_control_2.rtf , eform constant nogap se(2) b(2)

*3.7 Appendix E5: Regression - clustering on countries*
logit Q2victims populistparty##c.women_rate genderofthespeaker femm_com party_chair_gender seniority, or cluster(state)
estimate store model_1_clus_count
logit Q2samerights populistparty##c.women_rate genderofthespeaker femm_com party_chair_gender seniority , or cluster(state)
estimate store model_2_clus_count
esttab model_1_clus_count model_2_clus_count using models_clus_count.rtf , eform constant nogap se(2) b(2)

*3.8 Appendix E6: Regression - speech selection*
logit Q2victims populistparty##c.women_rate genderofthespeaker femm_com party_chair_gender seniority i.state i.term if sub_samp==1 , or cluster(party)
estimates store e6
esttab e6  using sub_sample.rtf , eform constant nogap se(2) b(2)